|
This page last changed on Nov 28, 2008.
Database Function Library Declarations
The following sample shows the code automatically created when you add a database function declaration to a library.
(::pragma function <f:function xmlns:f="urn:annotations.ld.oracle.com" visibility="public" kind="library"
isPrimary="false"
nativeName="Function1"
nativeLevel1Container="catalog1"
nativeLevel2Container="schema1"
nativeLevel3Container="package1">
<nonCacheable/>
</f:function>::-) declare function f1:Function1() as xdt:anyAtomicType? external;
Notice that the function is identified as external to the application.
Note: The sequence of dataSource elements carry the names of the relational sources to which the specified functions apply. The native qualified name of each function is captured in the values of
"nativeLevelNContainer" (N = 1,2,3)
and
For example, the qualified name of a custom SQL function MEDIAN, defined under package STATISTICS, is represented by the following annotation:
(::pragma function
<f:function xmlns:f="urn:annotations.ld.oracle.com"
nativeName="MEDIAN" nativeLevel3Container="STATISTICS"/> ::-)
The qualified name (the qname) of the XQuery function representing the native function is user-defined. The native signature of each function is reflected in the signature specified by the XQuery function declaration.
In the case of user-defined SQL functions, the SQL type of an input parameter or output of the SQL function (e.g., TIME) is reflected in the corresponding XQuery type in the function signature (e.g., xs:time).
 | It is important that type mappings between XML and SQL be correct. |
|